<layout name="page" />
<block name="content">
	{:widget('page_header/simple',array('name'=>'任务详情'))}
	<div class="operate-panel">
		<a class="btn btn-normal" onclick="go_return_url()">返回</a>
	</div>
	<div class="frame">
		<form method='post' id="form_data" name="form_data" enctype="multipart/form-data"  >
			<input type="hidden" name="id" value="{$vo.id}">
			<input type="hidden" name="project_id" value="{$vo.project_id}">
			<input type="hidden" name="opmode" value="edit">
			<div class="box col-6">
				<label class="input-label" for="name">标题*：</label>
				<div class="input-box">
					{$vo.name}
				</div>
			</div>
			<div class="box col-6">
				<label class="input-label" for="name">截至日期*：</label>
				<div class="input-box">
					{$vo.end_date}
				</div>
			</div>
			<div class="box col-6">
				<label class="input-label" for="name">工作量：</label>
				<div class="box col-6">
					{$vo.workload}
				</div>
			</div>
			<div class="box col-6">
				<label class="input-label" for="name">指派人：</label>
				<div class="box col-6">
					{$vo.user_name}
				</div>
			</div>
			<div class="box col-6">
				<label class="input-label" for="name">执行人：</label>
				<div class="box col-6">
					{$vo.executor_name}
				</div>
			</div>
			<foreach name="field_list" val="field_vo">
				{:widget('UserDefineField/view',array($field_vo))}
			</foreach>
			<div class="box col-6">
				<label class="input-label" >任务描述：</label>
				<div class="content-wrap">
					{$vo.content}
				</div>
			</div>
			<div class="box col-6">
				<label class="input-label" >附件：</label>
				{:widget('file_upload/view',array('add_file'=>$vo['add_file']))}
			</div>
		</form>
	</div>

	{:widget('page_header/sub',array('name'=>'任务完成情况'))}
	<if condition="($is_edit) and ($vo['is_finish']!=4)">
		<div class="frame">
			<form method="post" action="" name="form_finish" id="form_finish" >
				<input type="hidden" name="id" value="{$vo.id}">
				<input type="hidden" name="project_id" value="{$vo.project_id}">
				<input type="hidden" name="opmode" value="edit">
				<div class="box col-12">
					<label class="input-label" >状态：</label>
					<select class="select w16" name="is_finish" id="is_finish">
						<option >请选择状态</option>
						<option value="1">进行中</option>
						<option value="2">延迟</option>
						<option value="3">已完成</option>
					</select>
					<i class="icon"></i>
				</div>
				<div class="box col-12">
					<label class="input-label" >完成情况：</label>
					<textarea class="textarea simple" name="comment" class="col-xs-12" style="height:200px">{$vo.comment}</textarea>
				</div>
				<div class="box col-12">
					<label class="input-label text-right" >附件：</label>
					{:widget('file_upload/edit',array('add_file'=>$vo['task_file'],'task_file'))}
				</div>
				<div class="box col-12">
					<label class="input-label" ></label>
					<a class="btn btn-normal" onclick="save()">保存</a>
					<a class="btn btn-return" onclick="go_return_url()">取消 </a>
				</div>
			</form>
		</div>
		<else/>
		<div class="frame">
			<div class="box col-12">
				<label class="input-label" >任务标题：</label>
				<div class="input-box">
					{$vo.name}
				</div>
			</div>
			<div class="box col-12">
				<label class="input-label text-right" >状态：</label>
				<div class="input-box">
					{$vo.is_finish|project_is_finish}
				</div>
			</div>
			<div class="box col-12">
				<label class="input-label" >完成情况：</label>
				<div class="content-wrap">
					{$vo.comment}
				</div>
			</div>
			<div class="box col-12">
				<label class="input-label" >附件：</label>
				{:widget('file_upload/view',array('add_file'=>$vo['task_file'],'task_file'))}
			</div>
		</div>
	</if>
</block>

<block name="js">
	<script type="text/javascript">
		layui.use(['global', 'uploader', 'editor'], function() {
			var $ = layui.jquery;
			var fn = {
				save : function() {
					send_form("form_finish", "{:url('save_task')}", '{:url("read",array("id"=>$vo["project_id"]))}', function(ret) {
						if (ret.status) {
							layer.msg(ret.info, {
								time : 1200
							}, function() {
								location.href = '{:url("read",array("id"=>$vo["project_id"]))}';
							});
						} else {
							layer.msg(ret.info);
							return false;
						}
					});
				}
			};
			win_exp(fn);
			set_val('is_finish', '{$vo.is_finish}');
		});

	</script>
</block>